//数据库操作
const mysql = require('mysql');
const pool = mysql.createPool({
  host: '127.0.0.1',
  user: 'root',
  password: 'password',
  database: 'hdytest',
});

let query = (sql, values)=>{
  return new Promise((resolve, reject)=>{
    pool.getConnection((err, connection)=>{
      if (err) {
        reject(err);
      } else {
        connection.query(sql,values,(error, reslut)=>{
          if (error) {
            reject(error);
          } else {
            resolve(reslut);
          }
        });
      }
    });
  })
};
module.exports = {query};
